<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Profile extends MY_Controller {

	function __construct() {
		parent::__construct();
	}
	
	public function index($profile_id)
	{
		if($this->LoggedIn()){
			$this->load->model('user_model');
			$this->load->model('offer_model');
			
			$profile = $this->user_model->get_user($profile_id);
			$offers = $this->offer_model->get_offers_by_fb_id($profile_id);
			$data['profile'] = $profile;
			$data['offers'] = $offers;
			
			if($profile_id == $this->fb_id){
				$data['edit'] = true;
			}
			else{
				$data['edit'] = false;
			}
			
			$data['successful_offers'] = '?';
			$data['successful_requests'] = '?';
			$preferences = array(
				'email_frequency' => 3,
				'email_details' => array(
					NEW_OFFERS => true,
					NEW_REQUESTS => false,
					NEW_COMMENTS => true,
					NEW_NOTIFICATIONS => false,
				),
			);
			$data['preferences'] = $preferences;
			
			$data['title'] = 'My Profile';
			$data['content_view'] = 'profile_view';
			$data['stylesheets'] = array('profile');
			$data['javascripts'] = array();
			$this->load_view($data, TRUE);
		}
	}
}
